home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0078_Read VGA Dacs.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  2KB  |  38 lines

  1. {
  2. >Well, I have a procedure to return the VGA palette registers in BYTE
  3. >vars called like
  4.  
  5. >GetColor(Color,Red,Green,Blue:BYTE);
  6.  
  7. This will not return anything as they will be removed from the Stack.  You
  8. can pass like this, but you can no receive.  You must use Var R,G,B:Byte;
  9.  
  10. >I want to do thgis, but in assembler:
  11.  
  12. >││   PORT[$3C8] := Color;
  13. >││   Red        := PORT[$3C9];
  14. >││   Green      := PORT[$3C9];
  15. >││   Blue       := PORT[$3C9];
  16.  
  17. >but in assembler....argh, any ideas?
  18. }
  19.  
  20. Procedure VGAReadDAC(Reg:Byte; Var R,G,B:Byte); Assembler;
  21. ASM
  22.   MOV   DX,3C7h                     {; |Send Starting DAC Register    }
  23.   MOV   AL,[Reg]                    {; |                              }
  24.   OUT   DX,AL                       {;/                               }
  25.   INC   DX                          {; |DX:=DAC Data Address          }
  26.   INC   DX                          {;/                               }
  27.   IN    AL,DX                       {; |Read Red Byte                 }
  28.   LES   DI,[R]                      {; |                              }
  29.   MOV   [ES:DI],AL                  {;/                               }
  30.   IN    AL,DX                       {; |Read Green Byte               }
  31.   LES   DI,[G]                      {; |                              }
  32.   MOV   [ES:DI],AL                  {;/                               }
  33.   IN    AL,DX                       {; |Read Blue Byte                }
  34.   LES   DI,[B]                      {; |                              }
  35.   MOV   [ES:DI],AL                  {;/                               }
  36. End;
  37.  
  38.